import librosa
#import wavefile

# pip install python_speech_features ，不行的话百度一下
from python_speech_features import mfcc
# 特征提取，feat = compute_mfcc(wadict[wavid])
def compute_mfcc(file):
	# fs, audio = wavfile.read(file)
	y, sr = librosa.load('../resources/C2_2_y.wav')
	# 这里我故意fs/2,有些类似减小step，不建议这样做，投机取巧做法
	mfcc_feat = mfcc(y, samplerate=sr, numcep=13, nfft=1024, appendEnergy=False)
	return mfcc_feat




# y, sr = librosa.load('../resources/C2_2_y.wav', sr=16000)
y, sr = librosa.load('../resources/C2_2_y.wav')
# 提取 MFCC feature
mfccs = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=13, n_fft=1024)

mfccs_2 = compute_mfcc('../resources/C2_2_y.wav')

print(type(mfccs_2))
print(mfccs_2.shape)

print(type(mfccs))



print(mfccs.shape)        # (40, 65)